package com.dushibao.front;

import com.dushibao.entity.GoodsClass;
import com.dushibao.service.GoodsClassService;
import com.dushibao.service.impl.GoodsClassServiceImpl;
import com.dushibao.view.ModelAndView;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/index")
public class IndexServlet extends HttpServlet {
    GoodsClassService goodsClassService = new GoodsClassServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<GoodsClass> goodsClasses = goodsClassService.getParents();

        req.setAttribute("goodsClasses",goodsClasses);

        ModelAndView mv = new ModelAndView("index");
    }
}
